<template>
    <div class="app-container">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" label-width="110px">
            <el-form-item label="学生姓名" prop="XSXM">
                <el-input v-model="queryParams.XSXM" placeholder="请输入学生姓名" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="考生号" prop="KSH">
                <el-input v-model="queryParams.KSH" placeholder="请输入考生号" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="身份证号" prop="SFZH">
                <el-input v-model="queryParams.SFZH" placeholder="请输入身份证号" clearable
                    @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="手机号" prop="SJH">
                <el-input v-model="queryParams.SJH" placeholder="请输入手机号" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="校编学号" prop="XH">
                <el-input v-model="queryParams.XH" placeholder="请输入校编学号" clearable @keyup.enter.native="handleQuery" />
            </el-form-item>
            <el-form-item label="注册状态" prop="regStatus">
                <el-select v-model="queryParams.regStatus" placeholder="请选择注册状态" clearable>
                    <el-option v-for="dict in dict.type.srs_stu_reg_status" :key="dict.value" :label="dict.label"
                        :value="dict.value" />
                </el-select>
            </el-form-item>
            <el-form-item>
                <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
                <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
            </el-form-item>
        </el-form>
        <el-table v-loading="loading" :data="stu_list">
            <el-table-column label="查看任务" align="center" class-name="small-padding fixed-width" fixed="left">
                <template slot-scope="scope">
                    <el-button size="mini" type="text" icon="el-icon-view" @click="lookTask(scope.row)">查看</el-button>
                </template>
            </el-table-column>
            <el-table-column label="学院" align="center" prop="deptName" width="140" />
            <el-table-column label="专业" align="center" prop="majorName" width="270" />
            <el-table-column label="班级" align="center" prop="className" width="270" />
            <el-table-column label="考生号" align="center" prop="ksh" width="150" />
            <el-table-column label="学生姓名" align="center" prop="xsxm" width="100" />
            <el-table-column label="性别" align="center" prop="xb" width="60" />
            <el-table-column label="分配的宿舍" align="center" prop="dorm" />
            <el-table-column label="注册状态" align="center" prop="regStatus">
                <template slot-scope="scope">
                    <dict-tag :options="dict.type.srs_stu_reg_status" :value="scope.row.regStatus" />
                </template>
            </el-table-column>

        </el-table>
        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum"
            :limit.sync="queryParams.pageSize" @pagination="getList" />


        <el-dialog title="查看学生任务" :visible.sync="taskV">
            <el-table :data="task_list">
                <el-table-column label="学生姓名" align="center" prop="stuName" width="120" />
                <el-table-column label="任务序号" align="center" prop="rowRank" />
                <el-table-column label="任务名称" align="center" prop="taskName" />
                <el-table-column label="是否完成" align="center" prop="status">
                    <template slot-scope="scope">
                        <dict-tag :options="dict.type.srs_remain_status" :value="scope.row.status" />
                    </template>
                </el-table-column>
            </el-table>
        </el-dialog>

    </div>
</template>
<script>
import { listFdy } from "@/api/stureg/stu";

import { listStuTodo } from "@/api/stureg/stu_todo";

import { workbook2blob, openDownloadDialog, dbfToJson, isEmpty, fullLoading } from "@/api/helpFunc";


export default {
    name: "reg-stu-fdy",
    dicts: ['srs_stu_reg_status', 'srs_remain_status'],
    data() {
        return {
            stu_list: [],
            queryParams: {
                pageNum: 1,
                pageSize: 10,
                classCode: null
            },
            total: 0,
            loading: false,

            taskV: false,
            task_list: []
        }
    },
    created() {
        this.getList();
    },
    methods: {
        async lookTask(val) {
            let loading = fullLoading(this);
            let res = await listStuTodo(val.ksh);
            loading.close();
            if (res.code == 200) {
                this.task_list = [...res.data];
                console.log(this.task_list)
                this.taskV = true;
            }
        },
        async getList() {
            this.loading = true;
            let res = await listFdy(this.queryParams);
            this.loading = false;
            if (res.code == 200) {
                this.stu_list = [...res.rows];
                this.total = res.total;
            }
        },
        handleQuery() {
            this.queryParams.pageNum = 1;
            this.getList();
        },
        /** 重置按钮操作 */
        resetQuery() {
            this.resetForm("queryForm");
            this.handleQuery();
        },

    }
}


</script>